<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 300px;
      height: 300px;
      background-color: red;
      margin: 100px auto;
      transform: translate(0);
    }

    .inner {
      position: fixed;
      left: 0;
      top: 0;
      width: 100px;
      height: 100px;
      background-color: green;
    }
    /* 定位的元素 默认参考的是 浏览器的可视区
      但是 如果当前这个定位的元素的祖先元素, 设置了transform属性, 
      参考的是近设置了transform属性的元素
    */
  </style>
</head>
<body>
  <div class="box">
    <div class="inner"></div>
  </div>
</body>
</html>